#include <stdio.h>
#include <string.h>

int main(){
    struct _IO_FILE* fp = fopen("./1.txt", "w+");
    if(fp == NULL){
        perror("fopen");
        return 0;
    }

    const char* str = "nihao";
    size_t write_size = fwrite(str, 1, strlen(str), fp);
    if(write_size <= 0){
        perror("fwrite");
        return 0;
    }

    fseek(fp, 0, SEEK_SET);

    char buf[7] = { 0 };
    /*
     *  0 0 0 0 0 0 0 
     * linux-88\0
     * */
    fread(buf, 1, sizeof(buf) - 1, fp);

    printf("buf is %s\n", buf);
    fclose(fp);
    return 0;
}
